<form method="post" enctype="multipart/form-data" id="form-order">
<table class="table table-bordered table-hover">
    <thead>
        <tr>
            <th style="width: 1px;"><input type="checkbox" onclick="$('input[name*=\'ids\']').prop('checked', this.checked);"></th>
            <th>文章ID</th>
            <th>所属类别</th>
            <th>文章标题</th>
            <th>文章点击数</th> 
            <th>文章序号</th> 
            <th>添加时间</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody id="ajaxList"> 
        {if empty($list)}
            <tr>
                <td colspan="7" align="center">暂无数据</td>
            </tr>
        {/if}
        {foreach name="list" item="vo" key="k" }
          <tr role="row">
            <td><input type="checkbox" name="ids[]" value="{$vo.article_id}" onclick="attrBg(this)"></td>
            <td>{$vo.article_id}</td>
            <td>{$cats[$vo['kind_id']]['kind_name']}</td>
            <td><a href="{:url('home/index/article',array('id'=>$vo['article_id']))}" title="点击预览" target="_block">{$vo.title|getSubstr=0,33}
                {eq name="vo.is_home" value="1"}<font color="red">[首页]</font>{/eq}
                {eq name="vo.is_hot" value="1"}<font color="red">[热点]</font>{/eq}
                {eq name="vo.is_tj" value="1"}<font color="red">[新鲜事]</font>{/eq}
                </a></td>
            <td>{$vo.click}</td> 
            <td><input type="text" onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onpaste="this.value=this.value.replace(/[^\d]/g,'')" onchange="updateSort('article','article_id','{$vo.article_id}','sort_order',this)" size="4"  value="{$vo.sort_order}" /></td> 
            <td>{$vo.add_time}</td>
            <td>
              <a class="btn btn-primary" href="javascript:;" title="编辑" onclick="openYemian('/index.php/Admin/Article/article/act/edit/article_id/{$vo.article_id}','编辑文章内容')"><i class="fa fa-pencil"></i></a>
              <a class="btn btn-danger" href="javascript:void(0)" title="删除" data-url="{:url('Article/aticleHandle')}" data-id="{$vo.article_id}" onclick="delarticle(this,'确定把该文章加入回收站？',{$vo.article_id},'/index.php/Admin/Article/articleReback')"><i class="fa fa-trash-o"></i></a>
              <a href="javascript:void(0)" data-toggle="tooltip" class="btn btn-info" data-original-title="复制文章" title="复制文章" onclick="copyarticle(this,'确定复制该文章吗？',{$vo.article_id},'/index.php/Admin/Article/articlecopy')"><i class="fa fa-copy"></i></a>
            </td>
          </tr>
        {/foreach}
    </tbody>
</table>
</form>
<div>
    <div style="float:left;"><a href="javascript:void(0);" onclick="reback_select()" id="button-delete6" data-toggle="tooltip" title="删除" class="btn btn-danger" data-original-title="放入回收站">把选中文章放入回收站</a></div>
    <div style="float:right;margin-top:-20px;" id="pagelist">{$page|raw}<span style="float:right;margin:25px">共{$total}条</span></div>
</div>
<script>
    // 点击分页触发的事件
    $(".pagination a").click(function(){
        url = $(this).attr('href');
        ajax_get_table('formSearch',url);
        return false;
    });
    // 删除选中
    function reback_select(){
        parent.layer.confirm('确定把选中文章加入回收站？', function(){
            url = window.location.href;
            $.ajax({
                url:"/index.php/Admin/article/reback_select",
                data : $('#form-order').serialize(),
                success: function(v){
                    var v =  eval('('+v+')');
                    parent.layer.msg(v.message, {icon: v.icon,time: 1000});
                    if(v.hasOwnProperty('status') && (v.status == 1))
                        getAjaxList('ajaxList',1,"/index.php/Admin/Article/ajaxArticleList");
                }
            });
        });
    }

    function attrBg(obj){
        if($(obj).prop('checked')){
            $(obj).closest('tr').addClass('active_bg');
        }else{
            $(obj).closest('tr').removeClass('active_bg');
        }
    }
</script>